﻿<%@ Page Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeBehind="Messages.aspx.cs" Inherits="Matrix_network.Messages" %>

<asp:Content ID="Content1" ContentPlaceHolderId="MainContent" runat="server">
  
   <script  type="text/javascript" language="javascript">
                          
                            function DisplayDefaultImage(img)
                            {
                                img.src = "/Images/no_avatar.png";
                            }
   </script>

    <div style="text-align: left">
        <asp:LinkButton ID="IncomeLinkButton" runat="server" 
            onclick="IncomeLinkButton_Click" Text="<%$ Resources: inbox %>"></asp:LinkButton>
            /
        <asp:LinkButton ID="SendedLinkButton" runat="server" 
            onclick="SendedLinkButton_Click" Text="<%$ Resources: sent %>"></asp:LinkButton>
              
    </div>
  


    <asp:ObjectDataSource ID="MessagesDataSource"
        TypeName="Matrix_network.Code.MessagesDataSource" 
          Runat="server"  
            SelectMethod="GetMessagesList" EnablePaging="True" 
            SelectCountMethod="GetCount" oninit="MessagesDataSource_Init" 
        onselecting="MessagesDataSource_Selecting">
            
            <SelectParameters>
                <asp:Parameter Name="id" Type="Int32" />  
            </SelectParameters>
        </asp:ObjectDataSource>

        <asp:ObjectDataSource ID="OutMessagesDataSource"
        TypeName="Matrix_network.Code.MessagesDataSource" 
          Runat="server"  
            SelectMethod="GetMessagesOutList" EnablePaging="True" 
            SelectCountMethod="GetOutCount"
        >
            
            <SelectParameters>
                <asp:Parameter Name="id" Type="Int32" />  
            </SelectParameters>
        </asp:ObjectDataSource>
 
    <asp:MultiView ID="MsgMultiView" runat="server">
        
        <asp:View ID="IncomeMsgView" runat="server">
            <asp:ListView ID="MessagesView" runat="server" 
                DataSourceID="MessagesDataSource">
                <LayoutTemplate>
                    <table ID="msgsIn" bgcolor="black"  rules="rows" runat="server" cellpadding="2" style="line-height: 50px; width:100%; border: medium double #CCCCCC;margin: 15px; padding: 15px; width: 100%; text-align: left; vertical-align: top; background-color: #FFFFFF;">
                         <tr ID="itemPlaceholder" runat="server">
                        </tr>
                    </table>
                    <asp:DataPager ID="DataPager" runat="server" PageSize="10">
                        <Fields>
                            <asp:NumericPagerField ButtonCount="5" NextPageText="--&gt;" 
                                PreviousPageText="&lt;--" />
                        </Fields>
                    </asp:DataPager>
                </LayoutTemplate>
                <ItemTemplate>
                    <tr ID="Tr1" runat="server">
                        <td style="height:100;" >
                            
                               <div> <asp:Image runat="server" ID="img" Width="100" ImageUrl='<%# "Photo/"+ Eval("avaId") %>'
                                    onerror="DisplayDefaultImage(this)"/>
                                </div>    
                        </td>
                        <td>
                        <div>      
                            <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# "~/ViewProfile.aspx?id=" + Eval("fromId")%>'><%#Eval("from") %></asp:HyperLink>
                               </div>
                               <div>
                            <%#Eval("time")
                                %>
                                </div>
                        </td>
                        <td>
                            <%#Eval("message") %>
                        </td>
                        <td>
                            <asp:LinkButton ID="ShowMsgButton" runat="server" 
                                PostBackUrl='<%#"~/Message.aspx?msgId="+Eval("id")+"&fromId="+Eval("fromId") %>' Text="<%$ Resources: viewMessage %>"></asp:LinkButton>
                        </td>
                     </tr>  
                   
                </ItemTemplate>
            </asp:ListView>
        </asp:View>

        <asp:View ID="OutMsgView" runat="server">

            <asp:ListView ID="OutListView" runat="server" 
                DataSourceID="OutMessagesDataSource" oninit="OutListView_Init">
                <LayoutTemplate>
                    <table ID="msgsOut" bgcolor="black"  rules="rows" runat="server" cellpadding="2" style="line-height: 50px; width:100%; border: medium double #CCCCCC;margin: 15px; padding: 15px; width: 100%; text-align: left; vertical-align: top; background-color: #FFFFFF;">
                         <tr ID="itemPlaceholder" runat="server">
                        </tr>
                    </table>
                    <asp:DataPager ID="DataPager" runat="server" PageSize="10">
                        <Fields>
                            <asp:NumericPagerField ButtonCount="5" NextPageText="--&gt;" 
                                PreviousPageText="&lt;--" />
                        </Fields>
                    </asp:DataPager>
                </LayoutTemplate>
                <ItemTemplate>
                    <tr ID="Tr1" runat="server">
                        <td>
                        <div> <asp:Image runat="server" ID="img" Width="100" ImageUrl='<%# "Photo/"+ Eval("avaId") %>'
                                    onerror="DisplayDefaultImage(this)"/>
                                </div>    
                           
                        </td>
                        <td>
                            <div> 
                            <asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl='<%# "~/ViewProfile.aspx?id=" + Eval("toId")%>'><%#Eval("from") %></asp:HyperLink>
                                 
                                
                               </div>
                               <div>
                            <%#Eval("time")
                                %>
                                </div>
                        </td>
                        <td>
                            <%#Eval("message") %>
                        </td>
                        <td>
                            <asp:LinkButton ID="ShowMsgButton" runat="server" 
                                PostBackUrl='<%#"~/Message.aspx?msgId="+Eval("id")+"&toId="+Eval("toId") %>' Text="<%$ Resources: viewMessage %>"></asp:LinkButton>
                        </td>
                    </tr>
                </ItemTemplate>
            </asp:ListView>


        </asp:View>

    </asp:MultiView>

</asp:Content>
<asp:Content ID="Content2" runat="server" contentplaceholderid="HeadContent">
    <style type="text/css">
        .style1
        {
            width: 98px;
        }
        .style2
        {
            width: 81px;
        }
        .style3
        {
            width: 98px;
            height: 65px;
        }
        .style4
        {
            width: 81px;
            height: 65px;
        }
        .style5
        {
            height: 65px;
        }
    </style>
</asp:Content>

